<!--
 * comments...
 *
 * @category FaZend
 * @package View
 * @subpackage Helper
 * @see FaZend_View_Helper_HtmlTable
 * @see IndexController::tableAction()
 -->
 
<p>Table 1:</p>

<?php echo $this->htmlTable('test1')

    // hide column - don't show it
    ->hideColumn('id')

    // change the title of the column
    ->setColumnTitle('name', 'User Email')

    // change style
    ->addFormatter('name', true, "width:450px;")

    // ask table to calculate summ of this column
    ->setInjection('sum', $sum = new FaZend_Bo_Money())
    ->addFormatter('name', 'false; ${a3}->getInjection("sum")->add(1)')

    // allow raw html in the column
    ->allowRawHtml('password')

    // injected column
    ->addColumn('getDetails', 'id')

    // add simple converters
    ->addConverter('email', 'string')
    ->addConverter('password', '->isMe()')
    ->addConverter(
        'password', 
        'callback', 
        create_function(
            '$value, $row',
            'return $value ? "yes" : "no";'
        )
    )
    
    ->addFormatter('email', true, 'color:red')
    ->addFormatter(
        'email', 
        'callback', 
        create_function(
            '$value, $row',
            'return strlen($value) > 3 ? "color:green" : false;'
        )
    )
        
    // option
    ->addOption('approve', 'id', 'id', array('controller'=>'index', 'action'=>'index'))

    // conditional skip of the option
    ->skipOption('approve', create_function('$row', 'return true;'))

    // conditional skip of the option
    ->appendOptionToColumn('approve', 'email')

    // option
    ->addOption('test', null, null, array('id'=>create_function('$row', 'return "test";')), 'default')

    // option
    ->addColumnLink('approve', 'id', 'email', array('controller'=>'index', 'action'=>'index'))

    // set message if no data
    ->setNoDataMessage('works?')

    // data source
    ->setPaginator($this->paginator)
?>

<?php echo $this->paginator?>

<p>Table 2:</p>

<?php echo $this->htmlTable('test2')
    ->setPaginator($this->paginator)
    ?>

<?php assert($this->htmlTable('test1')->getInjection('sum') instanceof FaZend_Bo_Money); ?>
Summary of ID column: <?php echo $this->htmlTable('test1')->getInjection('sum')?>

